<?php
	/*
	 * Date: 2008.10.16
	 * Author:kylingood or kenji
	 * Email:kylingood@gmail.com
	 * QQ:37067087
	 * Blog:http://www.oophp.cn
	 */
	 header("content-type:text/html; charset=utf-8"); 
	error_reporting(E_ALL|E_STRICT);
	date_default_timezone_set('Asia/Shanghai');
	
	set_include_path('.' .PATH_SEPARATOR .'./library'.PATH_SEPARATOR .'./application/models/'.PATH_SEPARATOR .'./pulibc/images/'.PATH_SEPARATOR . get_include_path());
	require_once 'Zend/Loader.php';
	Zend_Loader::registerAutoload();//设置Zend Framework 自动载入类文件
	$registry = Zend_Registry::getInstance(); 
	$view = new Zend_View();
	$view->setScriptPath('./application/views/scripts/');//设置模板显示路径
	$registry['view'] = $view;//注册View
	
	//配置数据库参数,并连接数据库
	$config=new Zend_Config_Ini('./application/config/config.ini',null, true);
	Zend_Registry::set('config',$config);
	$dbAdapter=Zend_Db::factory($config->general->db->adapter,$config->general->db->config->toArray());
	$dbAdapter->query('SET NAMES UTF8');
	Zend_Db_Table::setDefaultAdapter($dbAdapter);
	Zend_Registry::set('dbAdapter',$dbAdapter);
	
		// 验证cookie中的用户名密码正确性
	if ($_COOKIE)
	{
		$authUser = new AuthUser();
		$authUser->GetCookieUserInfo();
	}
//	global $USER_INFO;
//	var_dump($USER_INFO);

	//设置控制器
	$frontController =Zend_Controller_Front::getInstance();
	$frontController->setBaseUrl('/htdocs')//设置基本路径
					->setParam('noViewRenderer', true)
					->setControllerDirectory('./application/controllers')
					->setDefaultControllerName('fivechess')
					->throwExceptions(true)
					->dispatch();
//hanframe test svn if it can write					